objects=nat64d.o dump.o checksum.o translate.o ipv4.o ipv6.o interfaces.o
CFLAGS=-Wall
CC=gcc

all: nat64d

.PHONY: disclean package install clean
clean: distclean
distclean:
	rm -f *.o nat64d

nat64d: $(objects)
	$(CC) $(objects) -o nat64d

package:
	dpkg-buildpackage -rfakeroot -b

install: all
	install -d $(DESTDIR)/usr/sbin
	install -d $(DESTDIR)/etc/network/if-down.d
	install -d $(DESTDIR)/etc/network/if-up.d
	install -m755 nat64d $(DESTDIR)/usr/sbin/
	install -m755 nat64-down $(DESTDIR)/etc/network/if-down.d/
	install -m755 nat64-up $(DESTDIR)/etc/network/if-up.d/


nat64d.o: system_headers.h ipv4.h ipv6.h interfaces.h nat64d.h
dump.o: system_headers.h checksum.h
checksum.o: system_headers.h checksum.h
translate.o: system_headers.h checksum.h interfaces.h nat64d.h
ipv4.o: system_headers.h translate.h checksum.h ipv4.h
ipv6.o: system_headers.h translate.h checksum.h ipv6.h
interfaces.o: system_headers.h interfaces.h
